------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  C:\Users\mbeissin\Desktop\Stata files for book\Robustnesstestfiles\Logfiles\robustnesstestschapter8.l
> og
  log type:  text
 opened on:  26 Jan 2022, 14:48:42

. * ============================================================================
. * ROBUSTNESS CHECKS FOR STATISTICAL RESULTS APPEARING IN CHAPTER 8
. * STATA  
. * Robustness checks for results reported in Chapter 8  
. * Author: Mark R. Beissinger  
. * Date:  January 2022  
. * Princeton, NJ 
. * =============================================================================
. * BEFORE RUNNING, YOU MUST SET THE DEFAULT PATH FOR WHERE THE DATA
. *   FILES RESIDE
. * =============================================================================
. * Before running, download the following packages for STATA:
. *       switchcopula from http://www.stata-journal.com/software/sj13-3
. *       collin from https://stats.oarc.ucla.edu/stata/ado/analysis/
. * ============================================================================
. * The following datafiles are used in this file:
. *   Data set of revolutionary episodes--revolutionaryeps.dta
. * =============================================================================
. * The following files are produced by these robustness tests: 
. *       Robustnesstestfiles\Logfiles\robustnesstestschapter8.log
. *
. *       The following graphs were produced by these tests:
. *               Robustnesstestfiles\Logfiles\robch8_scat1.pdf
. *               Robustnesstestfiles\Logfiles\robch8_scat2.pdf
. *               Robustnesstestfiles\Logfiles\robch8_scat3.pdf
. *               Robustnesstestfiles\Logfiles\robch8_scat4.pdf
. *       They were added to the end of the pdf output files for the robustness
. *               tests for the chapter.
. * =============================================================================
. 
. use revolutionaryeps.dta

. 
. * =====================================================================
. * ROBUSTNESS TESTS OF ENDOGENOUS SWITCHING MODEL, Model 3 in Table 8.2
. * =====================================================================
. * Boostrapped standard errors, 1000 replications, with bias-corrected standard errors
. * NOTE: THIS OPERATION CAN TAKE A WHILE TO EXECUTE
. bootstrap, reps(1000) seed(1234): switchcopula (lndeaths = success newpolitymin1 urbancivic newgdppcthl urbandum
> ) (lndeaths =  lnmonthsdur urbpercbefrev success) if startyear>1899, select (civilwar =  urbandum leftist ethnic
> order) copula0(clayton) copula1(fgm) margin1(normal) margin0(normal) margsel(normal) iterate(75)
(running switchcopula on estimation sample)

Bootstrap replications (1000)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
....x.............................................    50
.............x..................x............x....   100
...x........................................x.....   150
.....................................x......x.....   200
....................x...................x.........   250
....x.......x................x...x...........x....   300
..x...............................................   350
.....x.....x................................x.....   400
......x..........x................................   450
............x..................................x..   500
.x................................................   550
..x............................x..................   600
.............................................x....   650
...............x..................................   700
.......................................x..........   750
....x........x.....x...............x.............x   800
..................................................   850
..................................................   900
.........................x..............x.........   950
..........x..x....................................  1000

Swithching Regression: Copulas clayton-fgm, Margins probit-normal-normal

                                                Number of obs     =        230
                                                Replications      =        962
                                                Wald chi2(3)      =      84.27
Log likelihood = -569.93973                     Prob > chi2       =     0.0000

-------------------------------------------------------------------------------
              |   Observed   Bootstrap                         Normal-based
              |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
--------------+----------------------------------------------------------------
select        |
     urbandum |  -2.211441   .2670409    -8.28   0.000    -2.734832    -1.68805
      leftist |   .5557443   .2626634     2.12   0.034     .0409334    1.070555
  ethnicorder |   1.499009   .3114549     4.81   0.000     .8885681    2.109449
        _cons |   .6859092   .2237272     3.07   0.002     .2474119    1.124406
--------------+----------------------------------------------------------------
regime0       |
      success |  -1.647397   .4799129    -3.43   0.001    -2.588009   -.7067855
newpolitymin1 |  -.1013102   .0369398    -2.74   0.006    -.1737109   -.0289095
   urbancivic |  -1.681998   .4859814    -3.46   0.001    -2.634504   -.7294921
  newgdppcthl |  -.2261862    .066564    -3.40   0.001    -.3566493   -.0957232
     urbandum |  -4.682154   2.178898    -2.15   0.032    -8.952715   -.4115926
        _cons |   10.96281   2.247945     4.88   0.000     6.556923     15.3687
--------------+----------------------------------------------------------------
regime1       |
  lnmonthsdur |   .5766471   .1432726     4.02   0.000      .295838    .8574562
urbpercbefrev |   -.029129    .013327    -2.19   0.029    -.0552494   -.0030086
      success |   1.177386   .4050322     2.91   0.004     .3835378    1.971235
        _cons |   7.813654   .6949085    11.24   0.000     6.451658    9.175649
--------------+----------------------------------------------------------------
lnsigma0      |
        _cons |   .8296942   .0919665     9.02   0.000     .6494432    1.009945
--------------+----------------------------------------------------------------
lnsigma1      |
        _cons |   .6029933    .076951     7.84   0.000      .452172    .7538146
--------------+----------------------------------------------------------------
atheta0       |
        _cons |   .0372385   19.73822     0.00   0.998    -38.64896    38.72343
--------------+----------------------------------------------------------------
atheta1       |
        _cons |   6.474984   57.01929     0.11   0.910    -105.2808    118.2307
--------------+----------------------------------------------------------------
       sigma0 |   2.292617    .210844                      1.914474     2.74545
       sigma1 |   1.827581   .1406343                      1.571722    2.125091
       theta0 |   1.037941    20.4871                      1.64e-17    6.57e+16
       theta1 |   .9999952    .000542                            -1           1
         tau0 |  -.3416593   4.439682                            -1   -8.20e-18
         tau1 |  -.2222212   .0001204                     -.2222222    .2222222
-------------------------------------------------------------------------------
Wald test of independence :      Test statistic  6.6e+05 with p-value  0.0000
------------------------------------------------------------------------------

. * Bias-corrected standard errors
. estat bootstrap, bc

Swithching Regression: Copulas clayton-fgm, Margins probit-normal-normal
                                                Number of obs     =        230
                                                Replications      =        962

------------------------------------------------------------------------------
             |    Observed               Bootstrap
             |       Coef.       Bias    Std. Err.  [95% Conf. Interval]
-------------+----------------------------------------------------------------
select       |
    urbandum |   -2.211441  -.0430918   .26704095    -2.77193  -1.759281  (BC)
     leftist |   .55574427   .0147559   .26266342    .0421197   1.083353  (BC)
 ethnicorder |   1.4990086   .0229337   .31145493    .8715065   2.109204  (BC)
       _cons |   .68590918   .0158121   .22372721    .2547856   1.104524  (BC)
-------------+----------------------------------------------------------------
regime0      |
     success |  -1.6473975  -.0076524   .47991291   -2.502948  -.6478051  (BC)
newpolitym~1 |  -.10131017  -.0000191   .03693981   -.1752914  -.0275036  (BC)
  urbancivic |  -1.6819981   .0083719   .48598137   -2.593418   -.717527  (BC)
 newgdppcthl |  -.22618624   .0036922   .06656402   -.3654173  -.1170675  (BC)
    urbandum |  -4.6821537   .3312505   2.1788977    -17.4134  -2.229675  (BC)
       _cons |   10.962814  -.3398251   2.2479449    8.587548   28.75662  (BC)
-------------+----------------------------------------------------------------
regime1      |
 lnmonthsdur |    .5766471   -.001127    .1432726    .2824472   .8507219  (BC)
urbpercbef~v |  -.02912897  -.0019396   .01332697   -.0587777  -.0093117  (BC)
     success |   1.1773863  -.0157469   .40503223    .4039422   2.019733  (BC)
       _cons |   7.8136536   .0870305   .69490853    6.565419   9.231916  (BC)
-------------+----------------------------------------------------------------
lnsigma0     |
       _cons |   .82969416  -.0243662   .09196649    .7386602   1.152528  (BC)
-------------+----------------------------------------------------------------
lnsigma1     |
       _cons |   .60299327  -.0293997   .07695105    .4780687   .7687482  (BC)
-------------+----------------------------------------------------------------
atheta0      |
       _cons |   .03723853  -4.561173   19.738217   -38.29678   1.101364  (BC)
-------------+----------------------------------------------------------------
atheta1      |
       _cons |   6.4749844   10.99881   57.019289   -265.8669    7.69826  (BC)
------------------------------------------------------------------------------
(BC)   bias-corrected confidence interval
Note: One or more parameters could not be estimated in 38 bootstrap replicates;
      standard-error estimates include only complete replications.

. *       RESULT:  All results remained statistically significant, no sign shifts.
. 
. * Identification of potential outliers 
. quietly:  switchcopula (lndeaths = success newpolitymin1 urbancivic newgdppcthl urbandum) (lndeaths =  lnmonthsd
> ur urbpercbefrev success) if startyear>1899, select (civilwar =  urbandum leftist ethnicorder) copula0(clayton) 
> copula1(fgm) margin1(normal) margin0(normal) margsel(normal)

. predict xb0, xb0
(20 missing values generated)

. predict xb1, xb1
(96 missing values generated)

. predict cll, cll

. scatter  lndeaths  xb0 if civilwar==0 & e(sample), mlab(revid) || lfit xb0 lndeaths if civilwar==0 & e(sample)

. graph export Robustnesstestfiles\Logfiles\robch8_scat1.pdf, replace
(file Robustnesstestfiles\Logfiles\robch8_scat1.pdf written in PDF format)

. * Potential outliers:  revid 216, 1991 Uprisings in Iraq
. scatter  lndeaths  xb1 if civilwar==1 & e(sample), mlab(revid) || lfit xb1 lndeaths if civilwar==1 & e(sample)

. graph export Robustnesstestfiles\Logfiles\robch8_scat2.pdf, replace
(file Robustnesstestfiles\Logfiles\robch8_scat2.pdf written in PDF format)

. * Potential outliers:  revid 195, Togo 1991 Revolution
. *                                         revid 38, Chinese Civil War Part 1
. *                                         revid 359, Tunisian independence movement
. *                                         revid 367, Second Malayan Emergency
. *                                 revid 163, Chinese Civil War Part 2
. scatter  cll xb0  if e(sample) & civilwar==0, mlab(revid)

. graph export Robustnesstestfiles\Logfiles\robch8_scat3.pdf, replace
(file Robustnesstestfiles\Logfiles\robch8_scat3.pdf written in PDF format)

. * Potential outliers:  revid 384, Bajram Currie Revolt in 1922 
. scatter  cll xb1  if e(sample) & civilwar==1, mlab(revid)

. graph export Robustnesstestfiles\Logfiles\robch8_scat4.pdf, replace
(file Robustnesstestfiles\Logfiles\robch8_scat4.pdf written in PDF format)

. * Potential outliers:  revid 38, Chinese Civil War Part 1
. * Regression without outliers
. switchcopula (lndeaths = success newpolitymin1 urbancivic newgdppcthl urbandum) (lndeaths =  lnmonthsdur urbperc
> befrev success) if startyear>1899 & revid~= 216 & revid~=195 & revid~= 38 & revid~=359 & revid~=367 & revid~=163
>  & revid~=384, select (civilwar =  urbandum leftist ethnicorder) copula0(clayton) copula1(fgm) margin1(normal) m
> argin0(normal) margsel(normal)

Iteration 0:   log likelihood =   -538.646  (not concave)
Iteration 1:   log likelihood = -533.98149  (not concave)
Iteration 2:   log likelihood = -533.74592  
Iteration 3:   log likelihood = -531.49152  (not concave)
Iteration 4:   log likelihood = -531.28863  (not concave)
Iteration 5:   log likelihood = -531.22331  (not concave)
Iteration 6:   log likelihood = -531.18396  (not concave)
Iteration 7:   log likelihood = -531.14688  (not concave)
Iteration 8:   log likelihood = -531.07739  (not concave)
Iteration 9:   log likelihood = -531.02382  (not concave)
Iteration 10:  log likelihood = -530.97903  
Iteration 11:  log likelihood = -530.83237  
Iteration 12:  log likelihood = -530.33561  
Iteration 13:  log likelihood = -530.33231  
Iteration 14:  log likelihood = -530.33231  

Swithching Regression: Copulas clayton-fgm, Margins probit-normal-normal

                                                Number of obs     =        223
                                                Wald chi2(3)      =     100.25
Log likelihood = -530.33231                     Prob > chi2       =     0.0000

-------------------------------------------------------------------------------
              |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
--------------+----------------------------------------------------------------
select        |
     urbandum |   -2.32694   .2554735    -9.11   0.000    -2.827659   -1.826222
      leftist |   .5400551   .2326162     2.32   0.020     .0841358    .9959745
  ethnicorder |   1.574473   .2964669     5.31   0.000     .9934081    2.155537
        _cons |    .755312   .2349915     3.21   0.001     .2947372    1.215887
--------------+----------------------------------------------------------------
regime0       |
      success |  -1.524229   .4168823    -3.66   0.000    -2.341303   -.7071548
newpolitymin1 |  -.0884617   .0337608    -2.62   0.009    -.1546317   -.0222918
   urbancivic |  -1.592791    .420089    -3.79   0.000     -2.41615   -.7694313
  newgdppcthl |  -.2344197   .0620346    -3.78   0.000    -.3560053    -.112834
     urbandum |  -5.350911   .8812215    -6.07   0.000    -7.078074   -3.623749
        _cons |   11.53622   .9123362    12.64   0.000     9.748074    13.32437
--------------+----------------------------------------------------------------
regime1       |
  lnmonthsdur |   .5881044   .1260791     4.66   0.000     .3409938    .8352149
urbpercbefrev |  -.0237669   .0103687    -2.29   0.022    -.0440891   -.0034447
      success |   1.113575   .3312691     3.36   0.001     .4642993     1.76285
        _cons |    7.82074    .579499    13.50   0.000     6.684943    8.956537
--------------+----------------------------------------------------------------
lnsigma0      |
        _cons |   .8050432   .0639446    12.59   0.000     .6797141    .9303723
--------------+----------------------------------------------------------------
lnsigma1      |
        _cons |   .4441596   .0754173     5.89   0.000     .2963443    .5919749
--------------+----------------------------------------------------------------
atheta0       |
        _cons |   .1801652   .4934989     0.37   0.715    -.7870749    1.147405
--------------+----------------------------------------------------------------
atheta1       |
        _cons |   8.992911   2503.583     0.00   0.997     -4897.94    4915.926
--------------+----------------------------------------------------------------
       sigma0 |   2.236793   .1430309                      1.973313    2.535453
       sigma1 |   1.559179   .1175892                      1.344933    1.807555
       theta0 |   1.197415   .5909231                      .4551743    3.150009
       theta1 |          1   .0001547                            -1           1
         tau0 |  -.3744948   .1156013                     -.6116512   -.1853939
         tau1 |  -.2222222   .0000344                     -.2222222    .2222222
-------------------------------------------------------------------------------
LR test of independence :        Test statistic    5.965 with p-value  0.0326
------------------------------------------------------------------------------

. *       RESULT:  All variables significant at the .05 level or better. No signs changed.
. drop xb0 xb1 cll

. * Excluded ongoing episodes
. switchcopula (lndeaths = success newpolitymin1 urbancivic newgdppcthl urbandum) (lndeaths =  lnmonthsdur urbperc
> befrev success) if startyear>1899 & ongoing==0, select (civilwar =  urbandum leftist ethnicorder) copula0(clayto
> n) copula1(fgm) margin1(normal) margin0(normal) margsel(normal)

Iteration 0:   log likelihood = -563.47251  (not concave)
Iteration 1:   log likelihood = -557.68835  (not concave)
Iteration 2:   log likelihood = -557.09329  
Iteration 3:   log likelihood = -554.27383  
Iteration 4:   log likelihood = -553.77806  
Iteration 5:   log likelihood = -553.76666  
Iteration 6:   log likelihood = -553.76414  
Iteration 7:   log likelihood = -553.76362  
Iteration 8:   log likelihood =  -553.7635  
Iteration 9:   log likelihood = -553.76347  

Swithching Regression: Copulas clayton-fgm, Margins probit-normal-normal

                                                Number of obs     =        222
                                                Wald chi2(3)      =      96.68
Log likelihood = -553.76347                     Prob > chi2       =     0.0000

-------------------------------------------------------------------------------
              |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
--------------+----------------------------------------------------------------
select        |
     urbandum |  -2.179264   .2447787    -8.90   0.000    -2.659022   -1.699507
      leftist |   .5455138   .2296881     2.38   0.018     .0953333    .9956943
  ethnicorder |   1.459353   .2736173     5.33   0.000     .9230731    1.995633
        _cons |   .6521694   .2250993     2.90   0.004     .2109828    1.093356
--------------+----------------------------------------------------------------
regime0       |
      success |  -1.644802   .4245798    -3.87   0.000    -2.476963   -.8126404
newpolitymin1 |  -.1013784   .0345784    -2.93   0.003    -.1691508    -.033606
   urbancivic |  -1.680342     .43028    -3.91   0.000    -2.523675   -.8370084
  newgdppcthl |  -.2257948   .0624846    -3.61   0.000    -.3482624   -.1033272
     urbandum |  -4.614934   .8832852    -5.22   0.000    -6.346142   -2.883727
        _cons |   10.88919   .8939585    12.18   0.000     9.137064    12.64132
--------------+----------------------------------------------------------------
regime1       |
  lnmonthsdur |   .5675497   .1579944     3.59   0.000     .2578864    .8772131
urbpercbefrev |  -.0430677   .0143932    -2.99   0.003    -.0712778   -.0148576
      success |   1.294926   .3984723     3.25   0.001      .513935    2.075918
        _cons |   7.968346   .7063468    11.28   0.000     6.583932     9.35276
--------------+----------------------------------------------------------------
lnsigma0      |
        _cons |   .8303538   .0633767    13.10   0.000     .7061379    .9545698
--------------+----------------------------------------------------------------
lnsigma1      |
        _cons |   .6211262   .0767483     8.09   0.000     .4707023    .7715502
--------------+----------------------------------------------------------------
atheta0       |
        _cons |   .0507839   .4911813     0.10   0.918    -.9119139    1.013482
--------------+----------------------------------------------------------------
atheta1       |
        _cons |   6.732542   222.9655     0.03   0.976    -430.2717    443.7368
--------------+----------------------------------------------------------------
       sigma0 |    2.29413   .1453943                      2.026151    2.597553
       sigma1 |   1.861023   .1428303                      1.601118    2.163117
       theta0 |   1.052095   .5167697                      .4017546    2.755177
       theta1 |   .9999972   .0012661                            -1           1
         tau0 |  -.3447125   .1109509                     -.5794058   -.1672755
         tau1 |  -.2222216   .0002814                     -.2222222    .2222222
-------------------------------------------------------------------------------
LR test of independence :        Test statistic    8.448 with p-value  0.0091
------------------------------------------------------------------------------

. *       RESULT:  All variables significant at the .05 level or better. No signs changed.
. 
. 
. * +++++++++++++++++++++++++++++++++++++++++++
. * GLM ESTIMATIONS--CIVIL WAR PORTION OF MODEL
. * +++++++++++++++++++++++++++++++++++++++++++
. 
. * ===================================================================================
. * GLM: ESTIMATED CHANGE IN DEATHS DUE TO SHORTENED CIVIL WARS IN POST-COLD WAR PERIOD
. *               Model 3 in Table 8.2
. * ===================================================================================
. * GLM model on same sample as switching regression; obtain sample first, then run GLM estimation
. quietly: switchcopula (lndeaths = success newpolitymin1 urbancivic newgdppcthl urbandum) (lndeaths = lnmonthsdur
>  urbpercbefrev success) if startyear>1899, select (civilwar =  urbandum leftist ethnicorder) copula0(clayton) co
> pula1(fgm) margin1(normal) margin0(normal) margsel(normal)

. glm totaldeaths lnmonthsdur urbpercbefrev success if civilwar==1 & startyear>1899 & e(sample), family(gamma) lin
> k(log)

Iteration 0:   log likelihood = -1184.7266  
Iteration 1:   log likelihood = -1168.1326  
Iteration 2:   log likelihood = -1166.9205  
Iteration 3:   log likelihood = -1166.9187  
Iteration 4:   log likelihood = -1166.9187  

Generalized linear models                         No. of obs      =         93
Optimization     : ML                             Residual df     =         89
                                                  Scale parameter =   3.225176
Deviance         =   231.060241                   (1/df) Deviance =   2.596182
Pearson          =  287.0406757                   (1/df) Pearson  =   3.225176

Variance function: V(u) = u^2                     [Gamma]
Link function    : g(u) = ln(u)                   [Log]

                                                  AIC             =   25.18105
Log likelihood   = -1166.918742                   BIC             =  -172.3411

-------------------------------------------------------------------------------
              |                 OIM
  totaldeaths |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
--------------+----------------------------------------------------------------
  lnmonthsdur |    .443891   .1584719     2.80   0.005     .1332918    .7544903
urbpercbefrev |  -.0378198   .0094414    -4.01   0.000    -.0563246   -.0193149
      success |   1.238744   .3870245     3.20   0.001     .4801896    1.997298
        _cons |   9.959848   .7333449    13.58   0.000     8.522519    11.39718
-------------------------------------------------------------------------------

. * Calculate average duration for each period
. tabstat lnmonthsdur if civilwar==1 & startyear>1899, s(mean) by(timeperiods) save

Summary for variables: lnmonthsdur
     by categories of: timeperiods (Time period)

timeperiods |      mean
------------+----------
  1900-1949 |   3.40984
  1950-1984 |  4.638158
  1985-2014 |  3.862143
------------+----------
      Total |  4.000527
-----------------------

. mat total1 = r(Stat2)

. mat total2 = r(Stat3)

. local newtot1 = total1[1,1]

. display `newtot1'
4.6381585

. local newtot2 = total2[1,1]

. display `newtot2'
3.8621427

. * Calculate ln of average duration for each period
. local dur1 = `newtot1'

. local dur2 = `newtot2'

. * Calculate marginal effects for average durations for each period
. margins, atmeans at(lnmonthsdur=(`dur1' `dur2')) post

Adjusted predictions                            Number of obs     =         93
Model VCE    : OIM

Expression   : Predicted mean totaldeaths, predict()

1._at        : lnmonthsdur     =    4.638158
               urbpercbef~v    =    17.51282 (mean)
               success         =    .3978495 (mean)

2._at        : lnmonthsdur     =    3.862143
               urbpercbef~v    =    17.51282 (mean)
               success         =    .3978495 (mean)

------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         _at |
          1  |   139970.7   30111.44     4.65   0.000     80953.33      198988
          2  |   99182.99   18532.54     5.35   0.000     62859.88    135506.1
------------------------------------------------------------------------------

. * Calculate difference between marginal effects for each period
. scalar m1 = el(r(b),1,1)

. scalar m2 = el(r(b),1,2)

. scalar mdiff = m2 - m1

. * Calculate effect: Multiply effect times number of civil wars in post-Cold War period
. tab timeperiods civilwar if startyear>1899, matcell(tper)

           |  Revolution involved
           | civil war? (sustained
      Time |   warfare > 2 mos)
    period |        no        yes |     Total
-----------+----------------------+----------
 1900-1949 |        62         60 |       122 
 1950-1984 |        32         66 |        98 
 1985-2014 |        75         48 |       123 
-----------+----------------------+----------
     Total |       169        174 |       343 


. scalar cwnum = tper[3,2]

. display cwnum
48

. display mdiff * cwnum
-1957808.4

. * Drop scalars and macros
. macro drop _all

. scalar drop _all

. 
. * ============================================================================
. * GLM: ESTIMATED CHANGE IN DEATHS DUE TO URBANIZATION IN POST-COLD WAR PERIOD
. *               Model 3 in Table 8.2
. * ============================================================================
. * GLM model on same sample as switching regression; obtain sample first, then run GLM estimation
. quietly: switchcopula (lndeaths = success newpolitymin1 urbancivic newgdppcthl urbandum) (lndeaths = lnmonthsdur
>  urbpercbefrev success) if startyear>1899, select (civilwar =  urbandum leftist ethnicorder) copula0(clayton) co
> pula1(fgm) margin1(normal) margin0(normal) margsel(normal)

. glm totaldeaths lnmonthsdur urbpercbefrev success if civilwar==1 & startyear>1899 & e(sample), family(gamma) lin
> k(log)

Iteration 0:   log likelihood = -1184.7266  
Iteration 1:   log likelihood = -1168.1326  
Iteration 2:   log likelihood = -1166.9205  
Iteration 3:   log likelihood = -1166.9187  
Iteration 4:   log likelihood = -1166.9187  

Generalized linear models                         No. of obs      =         93
Optimization     : ML                             Residual df     =         89
                                                  Scale parameter =   3.225176
Deviance         =   231.060241                   (1/df) Deviance =   2.596182
Pearson          =  287.0406757                   (1/df) Pearson  =   3.225176

Variance function: V(u) = u^2                     [Gamma]
Link function    : g(u) = ln(u)                   [Log]

                                                  AIC             =   25.18105
Log likelihood   = -1166.918742                   BIC             =  -172.3411

-------------------------------------------------------------------------------
              |                 OIM
  totaldeaths |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
--------------+----------------------------------------------------------------
  lnmonthsdur |    .443891   .1584719     2.80   0.005     .1332918    .7544903
urbpercbefrev |  -.0378198   .0094414    -4.01   0.000    -.0563246   -.0193149
      success |   1.238744   .3870245     3.20   0.001     .4801896    1.997298
        _cons |   9.959848   .7333449    13.58   0.000     8.522519    11.39718
-------------------------------------------------------------------------------

. tabstat urbpercbefrev if civilwar==1 & startyear>1899, s(mean) by(timeperiods) save

Summary for variables: urbpercbefrev
     by categories of: timeperiods (Time period)

timeperiods |      mean
------------+----------
  1900-1949 |   8.39083
  1950-1984 |  15.62373
  1985-2014 |  27.01655
------------+----------
      Total |  17.23594
-----------------------

. mat total1 = r(Stat2)

. mat total2 = r(Stat3)

. local newtot1 = total1[1,1]

. display `newtot1'
15.623732

. local newtot2 = total2[1,1]

. display `newtot2'
27.016546

. * Reassign variables
. local urb1 = `newtot1'

. local urb2 = `newtot2'

. * Calculate marginal effects for average urbanization for each period
. margins, atmeans at(urbpercbefrev=(`urb1' `urb2')) post

Adjusted predictions                            Number of obs     =         93
Model VCE    : OIM

Expression   : Predicted mean totaldeaths, predict()

1._at        : lnmonthsdur     =    3.958544 (mean)
               urbpercbef~v    =    15.62373
               success         =    .3978495 (mean)

2._at        : lnmonthsdur     =    3.958544 (mean)
               urbpercbef~v    =    27.01655
               success         =    .3978495 (mean)

------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         _at |
          1  |   111185.8   20800.49     5.35   0.000     70417.61      151954
          2  |   72264.23   14938.18     4.84   0.000     42985.93    101542.5
------------------------------------------------------------------------------

. * Calculate difference between marginal effects for each period
. scalar m1 = el(r(b),1,1)

. scalar m2 = el(r(b),1,2)

. scalar mdiff = m2 - m1

. display mdiff
-38921.59

. * Calculate effect: Multiply effect times number of civil wars in post-Cold War period
. tab timeperiods civilwar if startyear>1899, matcell(tper)

           |  Revolution involved
           | civil war? (sustained
      Time |   warfare > 2 mos)
    period |        no        yes |     Total
-----------+----------------------+----------
 1900-1949 |        62         60 |       122 
 1950-1984 |        32         66 |        98 
 1985-2014 |        75         48 |       123 
-----------+----------------------+----------
     Total |       169        174 |       343 


. scalar cwnum = tper[3,2]

. display cwnum
48

. display mdiff * cwnum
-1868236.3

. * Drop scalars and macros
. macro drop _all

. scalar drop _all

. 
. * =================================================================================================
. * GLM: ESTIMATED CHANGE IN DEATHS DUE TO CHANGING RATES OF SUCCESS IN CIVIL WAR 
. *               IN POST-COLD WAR PERIOD, Model 3 in Table 8.2
. * =================================================================================================
. * GLM model on same sample as switching regression; obtain sample first, then run GLM estimation
. quietly: switchcopula (lndeaths = success newpolitymin1 urbancivic newgdppcthl urbandum) (lndeaths = lnmonthsdur
>  urbpercbefrev success) if startyear>1899, select (civilwar =  urbandum leftist ethnicorder) copula0(clayton) co
> pula1(fgm) margin1(normal) margin0(normal) margsel(normal)

. glm totaldeaths lnmonthsdur urbpercbefrev success if civilwar==1 & startyear>1899 & e(sample), family(gamma) lin
> k(log)

Iteration 0:   log likelihood = -1184.7266  
Iteration 1:   log likelihood = -1168.1326  
Iteration 2:   log likelihood = -1166.9205  
Iteration 3:   log likelihood = -1166.9187  
Iteration 4:   log likelihood = -1166.9187  

Generalized linear models                         No. of obs      =         93
Optimization     : ML                             Residual df     =         89
                                                  Scale parameter =   3.225176
Deviance         =   231.060241                   (1/df) Deviance =   2.596182
Pearson          =  287.0406757                   (1/df) Pearson  =   3.225176

Variance function: V(u) = u^2                     [Gamma]
Link function    : g(u) = ln(u)                   [Log]

                                                  AIC             =   25.18105
Log likelihood   = -1166.918742                   BIC             =  -172.3411

-------------------------------------------------------------------------------
              |                 OIM
  totaldeaths |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
--------------+----------------------------------------------------------------
  lnmonthsdur |    .443891   .1584719     2.80   0.005     .1332918    .7544903
urbpercbefrev |  -.0378198   .0094414    -4.01   0.000    -.0563246   -.0193149
      success |   1.238744   .3870245     3.20   0.001     .4801896    1.997298
        _cons |   9.959848   .7333449    13.58   0.000     8.522519    11.39718
-------------------------------------------------------------------------------

. * Calculate marginal effects for successful and failed revolutionary civil wars
. margins, atmeans at(success=(0 1)) post

Adjusted predictions                            Number of obs     =         93
Model VCE    : OIM

Expression   : Predicted mean totaldeaths, predict()

1._at        : lnmonthsdur     =    3.958544 (mean)
               urbpercbef~v    =    17.51282 (mean)
               success         =           0

2._at        : lnmonthsdur     =    3.958544 (mean)
               urbpercbef~v    =    17.51282 (mean)
               success         =           1

------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         _at |
          1  |   63239.22   15281.05     4.14   0.000      33288.9    93189.53
          2  |   218255.9   65108.78     3.35   0.001     90645.05    345866.8
------------------------------------------------------------------------------

. * Calculate difference between marginal effects for failed and successful revolutionary civil wars 
. scalar m1 = el(r(b),1,1)

. scalar m2 = el(r(b),1,2)

. scalar mdiff = m2 - m1

. display mdiff
155016.69

. * Calculate difference in number of successes for each period
. tab timeperiod success if civilwar==1 & startyear>1899, matcell(civsuc)

           | Succeeded in gaining
      Time |        power?
    period |        no        yes |     Total
-----------+----------------------+----------
 1900-1949 |        49         11 |        60 
 1950-1984 |        45         21 |        66 
 1985-2014 |        32         16 |        48 
-----------+----------------------+----------
     Total |       126         48 |       174 


. local cwnum2 = civsuc[2,2]

. display `cwnum2'
21

. local cwnum3 = civsuc[3,2]

. display `cwnum3'
16

. local cwnum4 = `cwnum3' - `cwnum2'

. display `cwnum4'
-5

. * Calculate effect:  Multiply difference in number of successes by difference in marginal effects
. display mdiff * `cwnum4'
-775083.46

. * Drop scalars and macros
. macro drop _all

. scalar drop _all

. 
. * ========================================================================================
. * GLM: ESTIMATED CHANGE IN DEATHS DUE TO CHANGING POLITY SCORES IN POST-COLD WAR PERIOD, 
. *               Model 4 in Table 8.2
. * ========================================================================================
. * GLM model on same sample as switching regression; obtain sample first, then run GLM estimation
. quietly: switchcopula (lndeaths = success newpolitymin1 urbancivic newgdppcthl urbandum) (lndeaths =  lnmonthsdu
> r urbpercbefrev success newpolitymin1) if startyear>1899, select (civilwar =  urbandum leftist ethnicorder) copu
> la0(clayton) copula1(fgm) margin1(normal) margin0(normal) margsel(normal)

. glm totaldeaths lnmonthsdur urbpercbefrev success newpolitymin1 if civilwar==1 & startyear>1899 & e(sample), fam
> ily(gamma) link(log)

Iteration 0:   log likelihood = -1182.5085  
Iteration 1:   log likelihood = -1166.0318  
Iteration 2:   log likelihood = -1164.6379  
Iteration 3:   log likelihood = -1164.6355  
Iteration 4:   log likelihood = -1164.6355  

Generalized linear models                         No. of obs      =         93
Optimization     : ML                             Residual df     =         88
                                                  Scale parameter =   3.022778
Deviance         =  226.4936927                   (1/df) Deviance =   2.573792
Pearson          =  266.0044392                   (1/df) Pearson  =   3.022778

Variance function: V(u) = u^2                     [Gamma]
Link function    : g(u) = ln(u)                   [Log]

                                                  AIC             =   25.15345
Log likelihood   = -1164.635468                   BIC             =  -172.3751

-------------------------------------------------------------------------------
              |                 OIM
  totaldeaths |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
--------------+----------------------------------------------------------------
  lnmonthsdur |   .4471563   .1526612     2.93   0.003     .1479458    .7463668
urbpercbefrev |  -.0361915   .0098284    -3.68   0.000    -.0554547   -.0169282
      success |    1.27706   .3765071     3.39   0.001     .5391193       2.015
newpolitymin1 |  -.0381542   .0305484    -1.25   0.212     -.098028    .0217196
        _cons |    9.84456   .7045522    13.97   0.000     8.463663    11.22546
-------------------------------------------------------------------------------

. * Calculate average Polity score of states experiencing civil wars for each period
. tabstat newpolitymin1 if civilwar==1 & startyear>1899, s(mean) by(timeperiods) save

Summary for variables: newpolitymin1
     by categories of: timeperiods (Time period)

timeperiods |      mean
------------+----------
  1900-1949 |  1.929825
  1950-1984 | -.6825397
  1985-2014 |  .3478261
------------+----------
      Total |        .5
-----------------------

. mat total1 = r(Stat2)

. mat total2 = r(Stat3)

. local pol1= total1[1,1]

. display `pol1'
-.68253968

. local pol2 = total2[1,1]

. display `pol2'
.34782609

. * Calculate marginal effects for average Polity score for each period
. margins, atmeans at(newpolitymin1=(`pol1' `pol2')) post

Adjusted predictions                            Number of obs     =         93
Model VCE    : OIM

Expression   : Predicted mean totaldeaths, predict()

1._at        : lnmonthsdur     =    3.958544 (mean)
               urbpercbef~v    =    17.51282 (mean)
               success         =    .3978495 (mean)
               newpolitym~1    =   -.6825397

2._at        : lnmonthsdur     =    3.958544 (mean)
               urbpercbef~v    =    17.51282 (mean)
               success         =    .3978495 (mean)
               newpolitym~1    =    .3478261

------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         _at |
          1  |   100202.9   18076.76     5.54   0.000     64773.09    135632.7
          2  |   96340.05   17748.33     5.43   0.000     61553.96    131126.1
------------------------------------------------------------------------------

. * Calculate difference between marginal effects for each period
. scalar m1 = el(r(b),1,1)

. scalar m2 = el(r(b),1,2)

. scalar mdiff = m2 - m1

. display mdiff
-3862.8292

. * Calculate effect: Multiply effect times number of civil wars in post-Cold War period
. tab timeperiods civilwar if startyear>1899, matcell(tper)

           |  Revolution involved
           | civil war? (sustained
      Time |   warfare > 2 mos)
    period |        no        yes |     Total
-----------+----------------------+----------
 1900-1949 |        62         60 |       122 
 1950-1984 |        32         66 |        98 
 1985-2014 |        75         48 |       123 
-----------+----------------------+----------
     Total |       169        174 |       343 


. scalar cwnum = tper[3,2]

. display cwnum
48

. display mdiff * cwnum
-185415.8

. * Drop scalars and macros
. macro drop _all

. scalar drop _all

. 
. 
. * ==============================================================================
. * GLM: ESTIMATED CHANGE IN DEATHS DUE TO POPULATION SIZE IN POST-COLD WAR PERIOD
. * ==============================================================================
. * GLM model on same sample as switching regression; obtain sample first, then run GLM estimation
. quietly: switchcopula (lndeaths = success newpolitymin1 urbancivic newgdppcthl urbandum) (lndeaths =  lnmonthsdu
> r urbpercbefrev success lnpop) if startyear>1899, select (civilwar =  urbandum leftist ethnicorder) copula0(clay
> ton) copula1(fgm) margin1(normal) margin0(normal) margsel(normal)

. glm totaldeaths lnmonthsdur urbpercbefrev success lnpop if civilwar==1 & startyear>1899 & e(sample), family(gamm
> a) link(log)

Iteration 0:   log likelihood = -1163.1323  
Iteration 1:   log likelihood = -1150.2393  
Iteration 2:   log likelihood = -1149.1946  
Iteration 3:   log likelihood = -1149.1934  
Iteration 4:   log likelihood = -1149.1934  

Generalized linear models                         No. of obs      =         93
Optimization     : ML                             Residual df     =         88
                                                  Scale parameter =   1.735348
Deviance         =  195.6095686                   (1/df) Deviance =   2.222836
Pearson          =  152.7106043                   (1/df) Pearson  =   1.735348

Variance function: V(u) = u^2                     [Gamma]
Link function    : g(u) = ln(u)                   [Log]

                                                  AIC             =   24.82136
Log likelihood   = -1149.193406                   BIC             =  -203.2592

-------------------------------------------------------------------------------
              |                 OIM
  totaldeaths |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
--------------+----------------------------------------------------------------
  lnmonthsdur |   .3970233   .1048194     3.79   0.000     .1915811    .6024654
urbpercbefrev |   -.032282   .0075328    -4.29   0.000     -.047046   -.0175179
      success |   1.178022   .2817538     4.18   0.000     .6257951     1.73025
        lnpop |   .4168451   .1019719     4.09   0.000     .2169838    .6167064
        _cons |   6.045968    1.01796     5.94   0.000     4.050804    8.041132
-------------------------------------------------------------------------------

. * Calculate average pop of states experiencing civil wars for each period
. tabstat lnpop if civilwar==1 & startyear>1899, s(mean) by(timeperiods) save

Summary for variables: lnpop
     by categories of: timeperiods (Time period)

timeperiods |      mean
------------+----------
  1900-1949 |  8.710207
  1950-1984 |   8.78433
  1985-2014 |    9.2585
------------+----------
      Total |  8.875878
-----------------------

. mat total1 = r(Stat2)

. mat total2 = r(Stat3)

. local pop1= total1[1,1]

. display `pop1'
8.7843297

. local pop2 = total2[1,1]

. display `pop2'
9.2585002

. * Calculate marginal effects for average pop for each period
. margins, atmeans at(lnpop=(`pop1' `pop2')) post

Adjusted predictions                            Number of obs     =         93
Model VCE    : OIM

Expression   : Predicted mean totaldeaths, predict()

1._at        : lnmonthsdur     =    3.958544 (mean)
               urbpercbef~v    =    17.51282 (mean)
               success         =    .3978495 (mean)
               lnpop           =     8.78433

2._at        : lnmonthsdur     =    3.958544 (mean)
               urbpercbef~v    =    17.51282 (mean)
               success         =    .3978495 (mean)
               lnpop           =      9.2585

------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         _at |
          1  |   71871.45   10284.87     6.99   0.000     51713.49    92029.42
          2  |   87578.44   11973.87     7.31   0.000     64110.08    111046.8
------------------------------------------------------------------------------

. * Calculate difference between marginal effects for each period
. scalar m1 = el(r(b),1,1)

. scalar m2 = el(r(b),1,2)

. scalar mdiff = m2 - m1

. display mdiff
15706.99

. * Calculate effect: Multiply effect times number of civil wars in post-Cold War period
. tab timeperiods civilwar if startyear>1899, matcell(tper)

           |  Revolution involved
           | civil war? (sustained
      Time |   warfare > 2 mos)
    period |        no        yes |     Total
-----------+----------------------+----------
 1900-1949 |        62         60 |       122 
 1950-1984 |        32         66 |        98 
 1985-2014 |        75         48 |       123 
-----------+----------------------+----------
     Total |       169        174 |       343 


. scalar cwnum = tper[3,2]

. display cwnum
48

. display mdiff * cwnum
753935.52

. * Drop scalars and macros
. macro drop _all

. scalar drop _all

. 
. * ======================================================================
. * ROBUSTNESS TESTS FOR SELECTION PORTION OF MODEL, Model 3 in Table 8.3
. * ======================================================================
. * Robust standard errors
. quietly: switchcopula (lndeaths = success newpolitymin1 urbancivic newgdppcthl urbandum) (lndeaths =  lnmonthsdu
> r urbpercbefrev success) if startyear>1899, select (civilwar =  urbandum leftist ethnicorder) copula0(clayton) c
> opula1(fgm) margin1(normal) margin0(normal) margsel(normal)

. probit civilwar urbandum leftist ethnicorder if startyear>1899 & e(sample), vce(robust)

Iteration 0:   log pseudolikelihood =  -155.1891  
Iteration 1:   log pseudolikelihood = -78.917118  
Iteration 2:   log pseudolikelihood = -78.150704  
Iteration 3:   log pseudolikelihood = -78.149942  
Iteration 4:   log pseudolikelihood = -78.149942  

Probit regression                               Number of obs     =        230
                                                Wald chi2(3)      =      89.83
                                                Prob > chi2       =     0.0000
Log pseudolikelihood = -78.149942               Pseudo R2         =     0.4964

------------------------------------------------------------------------------
             |               Robust
    civilwar |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    urbandum |  -2.175329   .2504676    -8.69   0.000    -2.666237   -1.684422
     leftist |   .5824157   .2632918     2.21   0.027     .0663734    1.098458
 ethnicorder |   1.337373   .2984891     4.48   0.000     .7523456    1.922401
       _cons |   .6900474   .2146764     3.21   0.001     .2692894    1.110805
------------------------------------------------------------------------------

. *       RESULT:  All variables remain statistically significant at the .05 level or better
. * Area under the curve
. lroc

Probit model for civilwar

number of observations =      230
area under ROC curve   =   0.9230

. graph export Robustnesstestfiles\Logfiles\robch8_lroc.pdf, replace
(file Robustnesstestfiles\Logfiles\robch8_lroc.pdf written in PDF format)

. *       RESULT:  Explains .9265 of area under the curve
. * Classification capacity
. estat classification

Probit model for civilwar

              -------- True --------
Classified |         D            ~D  |      Total
-----------+--------------------------+-----------
     +     |        72            10  |         82
     -     |        21           127  |        148
-----------+--------------------------+-----------
   Total   |        93           137  |        230

Classified + if predicted Pr(D) >= .5
True D defined as civilwar != 0
--------------------------------------------------
Sensitivity                     Pr( +| D)   77.42%
Specificity                     Pr( -|~D)   92.70%
Positive predictive value       Pr( D| +)   87.80%
Negative predictive value       Pr(~D| -)   85.81%
--------------------------------------------------
False + rate for true ~D        Pr( +|~D)    7.30%
False - rate for true D         Pr( -| D)   22.58%
False + rate for classified +   Pr(~D| +)   12.20%
False - rate for classified -   Pr( D| -)   14.19%
--------------------------------------------------
Correctly classified                        86.52%
--------------------------------------------------

. *       RESULT:  Model properly classifies 86.73 percent of cases
. * Testing for collinearity
. collin  urbandum  leftist ethnicorder if startyear>1899 & e(sample)
(obs=230)

  Collinearity Diagnostics

                        SQRT                   R-
  Variable      VIF     VIF    Tolerance    Squared
----------------------------------------------------
  urbandum      1.13    1.07    0.8812      0.1188
   leftist      1.09    1.04    0.9181      0.0819
ethnicorder      1.12    1.06    0.8910      0.1090
----------------------------------------------------
  Mean VIF      1.12

                           Cond
        Eigenval          Index
---------------------------------
    1     2.3035          1.0000
    2     0.8937          1.6055
    3     0.6775          1.8439
    4     0.1253          4.2880
---------------------------------
 Condition Number         4.2880 
 Eigenvalues & Cond Index computed from scaled raw sscp (w/ intercept)
 Det(correlation matrix)    0.8589

. *       RESULT:  tolerances are all > .5
. * Boostrapped standard errors
. quietly: switchcopula (lndeaths = success newpolitymin1 urbancivic newgdppcthl urbandum) (lndeaths =  lnmonthsdu
> r urbpercbefrev success) if startyear>1899, select (civilwar =  urbandum leftist ethnicorder) copula0(clayton) c
> opula1(fgm) margin1(normal) margin0(normal) margsel(normal)

. generate sample=0

. replace sample=1 if e(sample)==1
(230 real changes made)

. bootstrap, reps(1000) seed(1234): probit civilwar urbandum leftist ethnicorder if startyear>1899 & sample==1
(running probit on estimation sample)

Bootstrap replications (1000)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
..................................................    50
..................................................   100
..................................................   150
..................................................   200
..................................................   250
..................................................   300
..................................................   350
..................................................   400
..................................................   450
..................................................   500
..................................................   550
..................................................   600
..................................................   650
..................................................   700
..................................................   750
..................................................   800
..................................................   850
..................................................   900
..................................................   950
..................................................  1000

Probit regression                               Number of obs     =        230
                                                Replications      =      1,000
                                                Wald chi2(3)      =      70.30
                                                Prob > chi2       =     0.0000
Log likelihood = -78.149942                     Pseudo R2         =     0.4964

------------------------------------------------------------------------------
             |   Observed   Bootstrap                         Normal-based
    civilwar |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    urbandum |  -2.175329    .277518    -7.84   0.000    -2.719254   -1.631404
     leftist |   .5824157   .2793516     2.08   0.037     .0348966    1.129935
 ethnicorder |   1.337373   .3370359     3.97   0.000     .6767952    1.997952
       _cons |   .6900474   .2275607     3.03   0.002     .2440365    1.136058
------------------------------------------------------------------------------

. * Result: all variables remain significant at the .05 level or better.
. drop sample

. 
. 
. * ++++++++++++++++++++++++++++++++++++++
. * GLM ESTIMATES FOR NO CIVIL WAR REGIME
. * ++++++++++++++++++++++++++++++++++++++
. 
. * =======================================================================
. * GLM: ESTIMATED CHANGE IN DEATHS DUE TO CHANGING LOCATIONS FOR NO CIVIL 
. *               WAR REGIME, Model 5 in Table 8.4
. * =======================================================================
. * GLM model on same sample as switching regression; obtain sample first, then run GLM estimation
. quietly: switchcopula (lndeaths = success newpolitymin1 urbancivic newgdppcthl urbandum) (lndeaths =  lnmonthsdu
> r urbpercbefrev success) if startyear>1899, select (civilwar =  urbandum leftist ethnicorder) copula0(clayton) c
> opula1(fgm) margin1(normal) margin0(normal) margsel(normal)

. glm totaldeaths success newpolitymin1 urbancivic  newgdppcthl urbandum if civilwar==0 & startyear>1899 & e(sampl
> e), family(gamma) link(log)

Iteration 0:   log likelihood =  -1042.045  
Iteration 1:   log likelihood = -1009.4673  
Iteration 2:   log likelihood = -986.52415  
Iteration 3:   log likelihood = -986.11074  
Iteration 4:   log likelihood =  -986.1093  
Iteration 5:   log likelihood =  -986.1093  

Generalized linear models                         No. of obs      =        137
Optimization     : ML                             Residual df     =        131
                                                  Scale parameter =   5.194879
Deviance         =  488.6435915                   (1/df) Deviance =   3.730104
Pearson          =  680.5291614                   (1/df) Pearson  =   5.194879

Variance function: V(u) = u^2                     [Gamma]
Link function    : g(u) = ln(u)                   [Log]

                                                  AIC             =   14.48335
Log likelihood   = -986.1092991                   BIC             =  -155.8739

-------------------------------------------------------------------------------
              |                 OIM
  totaldeaths |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
--------------+----------------------------------------------------------------
      success |  -1.003941   .4597253    -2.18   0.029    -1.904986   -.1028963
newpolitymin1 |  -.0708483   .0337073    -2.10   0.036    -.1369134   -.0047833
   urbancivic |  -1.336458    .450903    -2.96   0.003    -2.220212   -.4527048
  newgdppcthl |  -.3123443   .0899487    -3.47   0.001    -.4886406    -.136048
     urbandum |  -1.706538    .838066    -2.04   0.042    -3.349117   -.0639588
        _cons |   9.832824   .8125524    12.10   0.000      8.24025     11.4254
-------------------------------------------------------------------------------

. * Calculate marginal effects for urban location
. margins, atmeans at(urbandum=(0 1)) post

Adjusted predictions                            Number of obs     =        137
Model VCE    : OIM

Expression   : Predicted mean totaldeaths, predict()

1._at        : success         =    .5109489 (mean)
               newpolitym~1    =   -1.708029 (mean)
               urbancivic      =    .3722628 (mean)
               newgdppcthl     =    3.685198 (mean)
               urbandum        =           0

2._at        : success         =    .5109489 (mean)
               newpolitym~1    =   -1.708029 (mean)
               urbancivic      =    .3722628 (mean)
               newgdppcthl     =    3.685198 (mean)
               urbandum        =           1

------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         _at |
          1  |     2421.9   1954.137     1.24   0.215    -1408.139    6251.939
          2  |   439.5581   88.95017     4.94   0.000     265.2189    613.8972
------------------------------------------------------------------------------

. * Calculate difference between marginal effects for urban and rural episodes without civil wars 
. scalar m1 = el(r(b),1,1)

. scalar m2 = el(r(b),1,2)

. scalar mdiff = m2 - m1

. display mdiff
-1982.3421

. * Calculate difference in number of urban episodes without civil wars for each period
. tab timeperiod urbandum if civilwar==0 & startyear>1899, matcell(civsuc)

           |   Episode occurred
           | primarily in an urban
      Time |        setting
    period |        no        yes |     Total
-----------+----------------------+----------
 1900-1949 |        15         47 |        62 
 1950-1984 |         3         29 |        32 
 1985-2014 |         2         73 |        75 
-----------+----------------------+----------
     Total |        20        149 |       169 


. local cwnum1 = civsuc[1,2]

. display `cwnum1'
47

. local cwnum3 = civsuc[3,2]

. display `cwnum3'
73

. local cwnum4 = `cwnum3' - `cwnum1'

. display `cwnum4'
26

. * Calculate effect:  Multiply difference in number of urban episodes without civil wars by difference in margina
> l effects
. display mdiff * `cwnum4'
-51540.895

. * Drop scalars and macros
. macro drop _all

. scalar drop _all

. 
. * ===================================================================
. * GLM: ESTIMATED CHANGE IN DEATHS DUE TO CHANGING GDP PER CAPITA FOR 
. *               NO CIVIL WAR REGIME
. * ===================================================================
. * GLM model on same sample as switching regression; obtain sample first, then run GLM estimation
. quietly: switchcopula (lndeaths = success newpolitymin1 urbancivic newgdppcthl urbandum ) (lndeaths =  lnmonthsd
> ur urbpercbefrev success) if startyear>1899, select (civilwar =  urbandum leftist ethnicorder) vce(robust) copul
> a0(clayton) copula1(fgm) margin1(normal) margin0(normal) margsel(normal) 

. quietly: glm totaldeaths success newpolitymin1 urbancivic newgdppcthl urbandum if civilwar==0 & startyear>1899 &
>  e(sample), family(gamma) link(log)

. * Calculate marginal effects for GDP per capita
. tabstat newgdppcthl if civilwar==0 & startyear>1899, s(mean) by(timeperiods) save

Summary for variables: newgdppcthl
     by categories of: timeperiods (Time period)

timeperiods |      mean
------------+----------
  1900-1949 |  1.713955
  1950-1984 |    4.2564
  1985-2014 |  4.667942
------------+----------
      Total |  3.506306
-----------------------

. mat total1 = r(Stat1)

. mat total3 = r(Stat3)

. local newtot1 = total1[1,1]

. display `newtot1'
1.7139552

. local newtot3 = total3[1,1]

. display `newtot3'
4.6679418

. * Reassign var
. local lev1 = `newtot1'

. local lev3 = `newtot3'

. * Calculate marginal effects for success rates for each period
. margins, atmeans at(newgdppcthl=(`lev1' `lev3')) subpop(if civilwar==0)

Adjusted predictions                            Number of obs     =        137
                                                Subpop. no. obs   =        137
Model VCE    : OIM

Expression   : Predicted mean totaldeaths, predict()

1._at        : success         =    .5109489 (mean)
               newpolitym~1    =   -1.708029 (mean)
               urbancivic      =    .3722628 (mean)
               newgdppcthl     =    1.713955
               urbandum        =    .9343066 (mean)

2._at        : success         =    .5109489 (mean)
               newpolitym~1    =   -1.708029 (mean)
               urbancivic      =    .3722628 (mean)
               newgdppcthl     =    4.667942
               urbandum        =    .9343066 (mean)

------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         _at |
          1  |   910.1274   239.6915     3.80   0.000     440.3407    1379.914
          2  |   361.7393   77.35939     4.68   0.000     210.1177    513.3609
------------------------------------------------------------------------------

. * Calculate difference between marginal effects for each period
. scalar m1 = el(r(b),1,1)

. scalar m3 = el(r(b),1,2)

. * Calculate effect: Multiply effect times number of non-civil-war episodes in post-Cold War period
. tab timeperiods civilwar if startyear>1899, matcell(tper)

           |  Revolution involved
           | civil war? (sustained
      Time |   warfare > 2 mos)
    period |        no        yes |     Total
-----------+----------------------+----------
 1900-1949 |        62         60 |       122 
 1950-1984 |        32         66 |        98 
 1985-2014 |        75         48 |       123 
-----------+----------------------+----------
     Total |       169        174 |       343 


. scalar ncwnum1 = tper[1,1]

. scalar ncwnum3 = tper[3,1]

. display ncwnum1
62

. display ncwnum3
75

. scalar effper1 = m1 * ncwnum1

. scalar effper3 = m3 * ncwnum3

. display effper3 - effper1
-29297.451

. * Drop scalars and macros
. macro drop _all

. scalar drop _all

. 
. * ==========================================================================
. * GLM: ESTIMATED CHANGE IN DEATHS DUE TO URBAN CIVIC REPERTOIRE IN EPISODES 
. *               WITH NO CIVIL WAR 
. * ==========================================================================
. * GLM model on same sample as switching regression; obtain sample first, then run GLM estimation
. quietly: switchcopula (lndeaths = success newpolitymin1 urbancivic newgdppcthl urbandum ) (lndeaths =  lnmonthsd
> ur urbpercbefrev success) if startyear>1899, select (civilwar =  urbandum leftist ethnicorder) copula0(clayton) 
> copula1(fgm) margin1(normal) margin0(normal) margsel(normal) 

. quietly: glm totaldeaths success newpolitymin1 urbancivic  newgdppcthl urbandum if civilwar==0 & startyear>1899 
> & e(sample), family(gamma) link(log)

. * Calculate marginal effects for urban civic
. margins, atmeans at(urbancivic=(0 1)) post

Adjusted predictions                            Number of obs     =        137
Model VCE    : OIM

Expression   : Predicted mean totaldeaths, predict()

1._at        : success         =    .5109489 (mean)
               newpolitym~1    =   -1.708029 (mean)
               urbancivic      =           0
               newgdppcthl     =    3.685198 (mean)
               urbandum        =    .9343066 (mean)

2._at        : success         =    .5109489 (mean)
               newpolitym~1    =   -1.708029 (mean)
               urbancivic      =           1
               newgdppcthl     =    3.685198 (mean)
               urbandum        =    .9343066 (mean)

------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         _at |
          1  |   808.6708   207.9003     3.89   0.000     401.1938    1216.148
          2  |   212.4982   73.00669     2.91   0.004      69.4077    355.5887
------------------------------------------------------------------------------

. * Calculate difference between marginal effects for urban civic without civil wars 
. scalar m1 = el(r(b),1,1)

. scalar m2 = el(r(b),1,2)

. scalar mdiff = m2 - m1

. display mdiff
-596.17261

. * Calculate difference in number of urban civic episodes without civil wars for each period
. tab timeperiod urbancivic if civilwar==0 & startyear>1899, matcell(civsuc)

      Time |  Urban civic episode
    period |        no        yes |     Total
-----------+----------------------+----------
 1900-1949 |        61          1 |        62 
 1950-1984 |        26          6 |        32 
 1985-2014 |        30         45 |        75 
-----------+----------------------+----------
     Total |       117         52 |       169 


. local cwnum1 = civsuc[1,2]

. display `cwnum1'
1

. local cwnum3 = civsuc[3,2]

. display `cwnum3'
45

. local cwnum4 = `cwnum3' - `cwnum1'

. display `cwnum4'
44

. * Calculate effect:  Multiply difference in number of urban civic episodes without civil wars by difference in m
> arginal effects
. display mdiff * `cwnum4'
-26231.595

. * Drop scalars and macros
. macro drop _all

. scalar drop _all

. 
. * ===============================================================
. * GLM: ESTIMATED CHANGE IN DEATHS DUE TO CHANGE IN FREQUENCY OF 
. *               OPPOSITION SUCCESS IN EPISODES WITH NO CIVIL WAR 
. * ===============================================================
. * GLM model on same sample as switching regression; obtain sample first, then run GLM estimation
. quietly: switchcopula (lndeaths = success newpolitymin1 urbancivic newgdppcthl urbandum ) (lndeaths =  lnmonthsd
> ur urbpercbefrev success) if startyear>1899, select (civilwar =  urbandum leftist ethnicorder) vce(robust) copul
> a0(clayton) copula1(fgm) margin1(normal) margin0(normal) margsel(normal) 

. quietly: glm totaldeaths success newpolitymin1 urbancivic newgdppcthl urbandum if civilwar==0 & startyear>1899 &
>  e(sample), family(gamma) link(log)

. * Calculate marginal effects for opposition success for revolutionary episodes
. margins, atmeans at(success=(0 1)) post

Adjusted predictions                            Number of obs     =        137
Model VCE    : OIM

Expression   : Predicted mean totaldeaths, predict()

1._at        : success         =           0
               newpolitym~1    =   -1.708029 (mean)
               urbancivic      =    .3722628 (mean)
               newgdppcthl     =    3.685198 (mean)
               urbandum        =    .9343066 (mean)

2._at        : success         =           1
               newpolitym~1    =   -1.708029 (mean)
               urbancivic      =    .3722628 (mean)
               newgdppcthl     =    3.685198 (mean)
               urbandum        =    .9343066 (mean)

------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         _at |
          1  |   821.2609   250.5798     3.28   0.001     330.1335    1312.388
          2  |   300.9366   89.50914     3.36   0.001     125.5019    476.3713
------------------------------------------------------------------------------

. * Calculate difference between marginal effects for successful episodes without civil wars 
. scalar m1 = el(r(b),1,1)

. scalar m2 = el(r(b),1,2)

. scalar mdiff = m2 - m1

. display mdiff
-520.32431

. * Calculate difference in number of successful episodes without civil wars for each period
. tab timeperiod success if civilwar==0 & startyear>1899, matcell(civsuc)

           | Succeeded in gaining
      Time |        power?
    period |        no        yes |     Total
-----------+----------------------+----------
 1900-1949 |        42         20 |        62 
 1950-1984 |        17         15 |        32 
 1985-2014 |        35         40 |        75 
-----------+----------------------+----------
     Total |        94         75 |       169 


. local cwnum1 = civsuc[1,2]

. display `cwnum1'
20

. local cwnum3 = civsuc[3,2]

. display `cwnum3'
40

. local cwnum4 = `cwnum3' - `cwnum1'

. display `cwnum4'
20

. * Calculate effect:  Multiply difference in number of successful episodes without civil wars by difference in ma
> rginal effects
. display mdiff * `cwnum4'
-10406.486

. * Drop scalars and macros
. macro drop _all

. scalar drop _all

. 
. * ========================================================================
. * GLM ESTIMATION: ESTIMATED EFFECT ON DEATHS OF POLITY SCORES IN EPISODES 
. *               WITHOUT CIVIL WARS, 1985-2014 vs. 1900-1949 
. * ========================================================================
. * Full switching model
. quietly: switchcopula (lndeaths = success newpolitymin1 urbancivic newgdppcthl urbandum ) (lndeaths =  lnmonthsd
> ur urbpercbefrev success) if startyear>1899, select (civilwar =  urbandum leftist ethnicorder) vce(robust) copul
> a0(clayton) copula1(fgm) margin1(normal) margin0(normal) margsel(normal) 

. quietly: glm totaldeaths success newpolitymin1 urbancivic newgdppcthl urbandum if civilwar==0 & startyear>1899 &
>  e(sample), family(gamma) link(log)

. tabstat newpolitymin1 if civilwar==0 & startyear>1899, s(mean) by(timeperiods) save

Summary for variables: newpolitymin1
     by categories of: timeperiods (Time period)

timeperiods |      mean
------------+----------
  1900-1949 |  .4833333
  1950-1984 |    -2.125
  1985-2014 | -1.930556
------------+----------
      Total | -1.085366
-----------------------

. mat total1 = r(Stat1)

. mat total3 = r(Stat3)

. local newtot1 = total1[1,1]

. display `newtot1'
.48333333

. local newtot3 = total3[1,1]

. display `newtot3'
-1.9305556

. * Reassign var
. local lev1 = `newtot1'

. local lev3 = `newtot3'

. * Calculate marginal effects for success rates for each period
. margins, atmeans at(newpolitymin1=(`lev1' `lev3')) subpop(if civilwar==0)

Adjusted predictions                            Number of obs     =        137
                                                Subpop. no. obs   =        137
Model VCE    : OIM

Expression   : Predicted mean totaldeaths, predict()

1._at        : success         =    .5109489 (mean)
               newpolitym~1    =    .4833333
               urbancivic      =    .3722628 (mean)
               newgdppcthl     =    3.685198 (mean)
               urbandum        =    .9343066 (mean)

2._at        : success         =    .5109489 (mean)
               newpolitym~1    =   -1.930556
               urbancivic      =    .3722628 (mean)
               newgdppcthl     =    3.685198 (mean)
               urbandum        =    .9343066 (mean)

------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         _at |
          1  |   420.9962   87.68008     4.80   0.000     249.1464     592.846
          2  |   499.5181   97.34304     5.13   0.000     308.7292    690.3069
------------------------------------------------------------------------------

. * Calculate difference between marginal effects for each period
. scalar m1 = el(r(b),1,1)

. scalar m3 = el(r(b),1,2)

. * Calculate effect: Multiply effect times number of non-civil-war episodes in post-Cold War period
. tab timeperiods civilwar if startyear>1899, matcell(tper)

           |  Revolution involved
           | civil war? (sustained
      Time |   warfare > 2 mos)
    period |        no        yes |     Total
-----------+----------------------+----------
 1900-1949 |        62         60 |       122 
 1950-1984 |        32         66 |        98 
 1985-2014 |        75         48 |       123 
-----------+----------------------+----------
     Total |       169        174 |       343 


. scalar ncwnum1 = tper[1,1]

. scalar ncwnum3 = tper[3,1]

. display ncwnum1
62

. display ncwnum3
75

. scalar effper1 = m1 * ncwnum1

. scalar effper3 = m3 * ncwnum3

. display effper3 - effper1
11362.09

. * Drop scalars and macros
. macro drop _all

. scalar drop _all

. 
. 
. 
. log close
      name:  <unnamed>
       log:  C:\Users\mbeissin\Desktop\Stata files for book\Robustnesstestfiles\Logfiles\robustnesstestschapter8.l
> og
  log type:  text
 closed on:  26 Jan 2022, 14:56:49
------------------------------------------------------------------------------------------------------------------
